package com.huidu.bitrade.entity;

import com.huidu.bitrade.constant.AnnouncementClassification;
import com.fasterxml.jackson.annotation.JsonFormat;

import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @author QQ：97095646
 * @description 公告
 * @date 2019/3/5 14:59
 */
@Entity
@Data
@Table
@ApiModel(value = "Announcement对象",description = "公告实体")
public class Announcement {
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    private Long id;

    @ApiModelProperty("标题")
    @NotNull(message = "标题不能为空")
    private String title;

    @ApiModelProperty("内容")
    @Column(columnDefinition="TEXT")
    @Basic(fetch=FetchType.LAZY)
    private String content;


    @CreationTimestamp
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty("类型：0.一般公告1.活动公告2.充提公告3.系统公告4.上币公告5.投票公告6.弹窗公告7.其他")
    @Excel(name = "分类", orderNum = "1", width = 20)
    @NotNull(message = "分类不能为空")
    private AnnouncementClassification announcementClassification;

    @ApiModelProperty("是否显示")
    private Boolean isShow;

    @ApiModelProperty("语言")
    private String lang;

    @ApiModelProperty("是否置顶")
    private String isTop;

    @Column(nullable = true)
    private String imgUrl;

    private int sort = 0 ;

    @ApiModelProperty("弹窗方式：0.不弹出1.只弹一次2.一直弹出")
    private Integer popUpCount;

    @ApiModelProperty("摘要")
    private String description;
}
